﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Monocle.Controllers.StaticHelpers;

namespace Monocle.Models.Facebook
{
    public class Facebook
    {
        private class Error
        {
            public String message { get; set; }
            public String type { get; set; }
            public String code { get; set; }
        }

        public static bool VerifyPageName(String pageName, FacebookViewModel vm)
        {
            var appID = "";
            var appSecret = ""; //TODO: Fetch from config file

            var AuthToken =
                WebStream.GetWebStream("https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id=" +
                             appID + "&client_secret=" + appSecret);
            var stream = WebStream.GetWebStream("https://graph.facebook.com/" + pageName + "&" + AuthToken);
            if (String.IsNullOrEmpty(stream))
                return false;

            return true;

        }
    }
}